# coding = UTF-8
from GBaseConnector import connect, GBaseError
import ibm_db
import time
import pandas as pd
from py2neo import Graph, Node, Relationship
import numpy as np
import datetime

configforGbase = {'host': '26.47.99.251', 'port': 5258, 'database': 'pms25', 'user': 'gbase',
                  'passwd': 'gbase20110531', 'connect_timeout': 388000, 'charset': 'utf8'}


def getDkxTz(dkxId):
    try:
        connGbase = connect()
        connGbase.connect(**configforGbase)
        curGbase = connGbase.cursor()
        getDkxTzSQL = '''
                SELECT DISTINCT 
                    tts.geo_positon
                FROM t_psr_tf_station tts
                WHERE tts.name IN #{tSbZwycDkxVo.dkxId}'''
        getDkxTzSQL = getDkxTzSQL.replace('#{tSbZwycDkxVo.dkxId}', dkxId)
        curGbase.execute(getDkxTzSQL)
        result = curGbase.fetchall()
        return result
    except Exception as e:
        print(e)
    finally:
        connGbase.close()
        curGbase.close()


if __name__ == '__main__':
    dkxid = "('龙城变','学富变')"
    print(dkxid)
    g = getDkxTz(dkxid)
    print(g)
# ,学富变